<template>
  <div class="container"
       v-if="card_info.style_pic||card_info.goods_image">
    <div class="list-item"
         v-if="img_url"
         :style="{'backgroundImage':'url('+(img_url+(card_info.style_pic||card_info.goods_image))+')'}">
      <div class="card-name">
        {{card_info.name||card_info.goods_name}}
      </div>
      <div class="dec">
        {{card_info.describe||card_info.goods_describe}}
      </div>
      <div class="price-bar">
        <div class="tip"
             v-if="(!card_info.card_user_str||card_info.card_user_str=='')&&(!card_info.user_name||card_info.user_name=='')">
          兑换价
        </div>
        <div class="price">
          <div class="icon">￥</div>
          <div class="num">{{card_info.sale_price||card_info.price||card_info.goods_sale_price}}</div>
        </div>
        <div class="lowest"
             v-if="card_info.deduction_number&&card_info.deduction_number!=0">
          最低可至¥{{card_info.ice_price}}
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import common from '@/assets/js/mmk_common.js'
export default {
  data () {
    return {
      base_url: common.image_resource,
      img_url: common.image_response,
    }
  },
  props: ["card_info"],
  watch: {
    card_info () {
      this.$forceUpdate()
    }
  }
}
</script>

<style lang="less" scoped>
.container {
  .list-item {
    height: 155px;
    border-radius: 8px;
    padding: 20px;
    box-sizing: border-box;
    position: relative;
    background-repeat: no-repeat;
    background-size: cover;
    .card-name {
      font-size: 18px;
      font-family: "PingFangSC-Medium", "PingFang SC";
      font-weight: 500;
      color: rgba(255, 255, 255, 1);
      line-height: 25px;
    }
    .dec {
      font-size: 14px;
      font-family: "PingFangSC-Regular", "PingFang SC";
      font-weight: 400;
      color: rgba(255, 255, 255, 1);
      line-height: 20px;
      margin-top: 5px;
    }
    .price-bar {
      position: absolute;
      left: 20px;
      bottom: 20px;
      .tip {
        width: 50px;
        height: 18px;
        background: rgba(255, 255, 255, 0.24);
        border-radius: 100px;
        font-size: 12px;
        font-family: "PingFangSC-Regular", "PingFang SC";
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
        line-height: 18px;
        text-align: center;
        display: inline-block;
        vertical-align: bottom;
        margin-right: 4px;
        margin-bottom: -2px;
      }
      .price {
        display: inline-block;
        vertical-align: bottom;
        margin-right: 10px;
        margin-bottom: -4px;
        .icon {
          font-size: 14px;
          font-family: "PingFangSC-Regular", "PingFang SC";
          font-weight: 400;
          color: rgba(255, 255, 255, 1);
          display: inline-block;
          vertical-align: baseline;
        }
        .num {
          font-size: 21px;
          font-family: "PingFangSC-Regular", "PingFang SC";
          font-weight: 400;
          color: rgba(255, 255, 255, 1);
          display: inline-block;
          vertical-align: baseline;
        }
      }
      .lowest {
        font-size: 12px;
        font-family: "PingFangSC-Regular", "PingFang SC";
        font-weight: 400;
        color: rgba(255, 255, 255, 1);
        display: inline-block;
        vertical-align: baseline;
      }
    }
  }
}
</style>